<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .contianer{
            width: 500px;
            background-color: bisque;

        }
        .box{
            height: 100px;
            width: 100px;
            background-color: aqua;
            margin: 5px;
        }
        .box1{
            height: 100px;
            width: 100px;
            background-color: aqua;
            margin: 5px;
            float: left;
        }
        .text{
            width: 150px;
            height: 150px;
            background-color: blueviolet;
        }
    </style>

</head>
<body>
    <h3>浮动副作用</h3>
    <p>浮动元素会造成父元素高度塌陷</p>
    <p>后续元素受到影响</p>

    <div class="contianer">

        <div class="box"></div>
        <div class="box"></div>
        <div class="box"></div>
    </div>

    <p>取消contianer 的高度后</p>
    
    <div class="contianer">

        <div class="box1"></div>
        <div class="box1"></div>
        <div class="box1"></div>
    </div>

    <p>浮动对后续box 的 影响</p>
    
    <div class="contianer">

        <div class="box1"></div>
        <div class="box1"></div>
        <div class="box1"></div>
        <div class="text"></div>
    </div>

    <h2 style="clear: left;">清除浮动方案(clear)</h2>
    <ol type="1">
        <li>父元素设置高度 父元素受影响</li>
        <li>受影响元素设置clear</li>
        <li>overflow 清除浮动</li>
        <li>伪对象方式</li>
    </ol>

    <div class="contianer" style="overflow: hidden;clear: both;">

        <div class="box1"></div>
        <div class="box1"></div>
        <div class="box1"></div>
        
    </div>
    <div class="text" ></div>

    <p>设置clear  left right both(直接全清)</p>
    <div class="contianer">

        <div class="box1"></div>
        <div class="box1"></div>
        <div class="box1"></div>
        <div class="text" style="clear: both;"></div>
    </div>

    <h3>伪对象方式</h3>

    <p>.contianer::after</p>

</body>
</html>